In [1]:
! pip install tensorflow
In [2]:
! pip install --upgrade pip
conda install numpy
In [3]:
! pip install numpy -I
In [4]:
import numpy.core.multiarray
In [5]:
!pip install spacy
In [7]:
! pip install scipy
In [8]:
! pip install opencv-python
In [9]:
! pip install pillow
In [10]:
! pip install matplotlib
In [11]:
! pip install h5py
In [12]:
! pip install keras
In [13]:
! pip3 install https://github.com/OlafenwaMoses/ImageAI/releases/download/2.0.2/imageai-2.0.2-py3-none-any.whl
Download the RetinaNet model file that will be used for object detection via this link https://github.com/OlafenwaMoses/ImageAI/releases/download/1.0/resnet50_coco_best_v2.0.1.h5
In [14]:
import os as os
In [15]:
os.getcwd()
Out[15]:
In [16]:
os.chdir('C:\\Users\\KOGENTIX\\Desktop\\image')
In [17]:
os.getcwd()
Out[17]:
In [23]:
from imageai.Detection import ObjectDetection
import os
execution_path = os.getcwd()
detector = ObjectDetection()
detector.setModelTypeAsRetinaNet()
detector.setModelPath( os.path.join(execution_path , "resnet50_coco_best_v2.0.1.h5"))
detector.loadModel()
detections = detector.detectObjectsFromImage(input_image=os.path.join(execution_path , "image.jpeg"), output_image_path=os.path.join(execution_path , "imagenew.jpeg"))
for eachObject in detections:
print(eachObject["name"] , " : " , eachObject["percentage_probability"] )
In [ ]: